package com.example.jdkDynamic;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

/**
 * TODO: 这里要写注释的!
 */
public class Main {
    public static void main(String[] args) {
        UserService userService= new UserServiceImpl();
        InvocationHandler invocationHandler= new MyInvocationHandler(userService);
        UserService proxy= (UserService) Proxy.newProxyInstance(userService.getClass().getClassLoader(),userService.getClass().getInterfaces(),invocationHandler);
        System.out.println(proxy.getName(1));
        System.out.println(proxy.getAge(1));
    }
}
